home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10886 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: rain.fr!world-net!usenet
  2. From: Frederic LACHASSE <lachass@worldnet.fr>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help with derived class of ifstream class
  5. Date: Sun, 10 Mar 1996 18:56:46 +0000
  6. Organization: World-Net information exchange, Internet provider.
  7. Message-ID: <VA.00000069.007dc50a@fred>
  8. References: <4hob5n$65c@daily-planet.nodak.edu>
  9. Reply-To: lachass@worldnet.fr
  10. NNTP-Posting-Host: pm9-009.sct.fr
  11. X-Newsreader: Virtual Access by Ashmount Research Ltd, http://www.ashmount.com
  12.  
  13. In article <4hob5n$65c@daily-planet.nodak.edu>, jengel@plains.nodak.edu 
  14. (John H. Engel) wrote:
  15. >
  16. > class X : public ifstream {
  17. >   ...
  18. > };
  19. >
  20. > int X::read(){
  21. >    int i;
  22. >    (*this) >> i;  // this is ok
  23. >    (*this) >> hex >> i;  // compiler does not like this
  24. > };
  25.  
  26. Use "::hex" instead of "hex". X is a subclass of ifstream, which has hex 
  27. defined in an enum of its ios base class, but you want to use the "ios& 
  28. hex(ios&)" defined outside the ios class.
  29.  
  30. I hope this'll help.
  31.  
  32.  Frederic LACHASSE (ECP 86)
  33.  CompuServe: 100530,2005
  34.  Internet: lachass@worldnet.fr
  35.  
  36.